<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%-- Include common set of tag library declarations for each layout --%>
<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=utf-8" errorPage="/error.jsp" isELIgnored="false" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.opensymphony.com/oscache" prefix="cache" %>
<%@ taglib uri="http://atleap.blandware.com/taglib" prefix="atleap" %>
<html:xhtml />

<atleap:constants className="org.apache.struts.Globals" var="MESSAGE_KEY" />
<html:html xhtml="true">
	<head>
        <!-- HTTP 1.1 -->
        <meta http-equiv="Cache-Control" content="no-store"/>
        <!-- HTTP 1.0 -->
        <meta http-equiv="Pragma" content="no-cache"/>
        <!-- Prevents caching at the Proxy Server -->
        <meta http-equiv="Expires" content="0"/>

        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <c:set var="ctxPath" value="${pageContext.request.contextPath}" scope="request"/>

        <atleap:base />

		<%-- Push tiles attributes in page context --%>
		<tiles:importAttribute ignore="true"/>
		<title>
            <atleap:message key="core.browser.title"/>
        </title>

        <%-- Get list of global Javascripts (scripts used on the most of pages or even on every page) --%>
        <tiles:useAttribute id="layoutScriptList" name="layoutScripts" classname="java.util.List" ignore="true"/>

        <atleap:iterator var="js" items="${layoutScriptList}">
            <script type="text/javascript" src="<atleap:rewriteUrl href="${js}" />"></script>
        </atleap:iterator>

        <%-- Get list of local Javascripts (scripts used on concrete page, built on this layout) --%>
        <tiles:useAttribute id="pageScriptList" name="pageScripts" classname="java.util.List" ignore="true"/>

        <atleap:iterator var="js" items="${pageScriptList}">
            <script type="text/javascript" src="<atleap:rewriteUrl href="${js}" />"></script>
        </atleap:iterator>

        <%-- Get list of global Stylesheets --%>
        <tiles:useAttribute id="layoutStyleList" name="layoutStyles" classname="java.util.List" ignore="true"/>
    
        <atleap:iterator var="css" items="${layoutStyleList}">
            <link rel="stylesheet" type="text/css" media="all" href="<atleap:rewriteUrl href="${css}"/>"  />
        </atleap:iterator>

        <%-- Get list of local Stylesheets --%>
        <tiles:useAttribute id="pageStyleList" name="pageStyles" classname="java.util.List" ignore="true"/>

        <atleap:iterator var="css" items="${pageStyleList}">
            <link rel="stylesheet" type="text/css" media="all" href="<atleap:rewriteUrl href="${css}"/>"  />
        </atleap:iterator>

        <script type="text/javascript">
            var brCurFolder = '';
            var brCurResourceType = '';
            window.fireResourceCreated = function(uri) {
                window.location.href = window.location;
            };
        </script>

    </head>

    <body id="browserBody">

        <div width="90%" align="right">
            <form onsubmit="return false;">
                <c:if test="${isResource}">
                    <input type="submit" class="button" style="margin: 5px;" onclick="doCallCreateContentResource(brCurFolder, brCurResourceType);" value="<atleap:message key="core.commons.buttons.create" />" />
                </c:if>
                <input type="submit" class="button" style="margin: 5px;" onclick="window.close();" value="<atleap:message key="core.commons.buttons.close" />" />
            </form>
        </div>
		<%-- Show menu --%>
		<atleap:prepareMenu name="${browserMenuName}" var="browserMenu" addLocaleSuffix="false" />
        <div id="menuDiv">
			<ul id="menuList">
				<atleap:iterator items="${browserMenu.components}" var="item">
					<c:set var="accessAllowed" value="true" />
					<c:if test="${!empty item.roles}">
						<atleap:isUserInRole roles="${item.roles}" var="accessAllowed" />
					</c:if>
					<c:if test="${(!empty item.url) && accessAllowed}">
						<atleap:message key="${item.title}" var="titleMsg" />
						<c:if test="${empty titleMsg}">
							<c:set var="titleMsg" value="${item.title}" />
						</c:if>
						<li><a href="${item.url}" title="${titleMsg}">${titleMsg}</a></li>
					</c:if>
				</atleap:iterator>
			</ul>
        </div>

		<%-- Show content --%>
		<div id="content">
			<tiles:get name="content" />
		</div>

    </body>

</html:html>
